﻿using System;
using System.Windows;
using System.Runtime.Serialization;

using SBPweb.PROvibe.Shared.Contracts.Content;
using SBPweb.PROvibe.Client.Framework.Utilities.Events;

namespace SBPweb.PROvibe.Client.Framework.Contracts.Content
{

    public interface IContentManager
    {

        [DataMember]
        ClientDescriptor Client
        {
            get;
        }

        [DataMember]
        ISessionManager Session
        {
            get;
        }

        [DataMember]
        IThemeManager Themes
        {
            get;
        }

        [DataMember]
        IPage CurrentPage
        {
            get;
        }

        event EventHandler Initializing;

        event EventHandler Initialized;

        event EventHandler Loading;

        event EventHandler Loaded;

        event EventHandler<TypedObjectEventArgs<IPage>> CurrentPageLoaded;
        
        event EventHandler<TypedObjectEventArgs<ISmartpart>> SmartpartLoaded;

        event EventHandler<TypedObjectEventArgs<IThemeManager>> ThemeManagerLoaded;


        void Initialize(ClientDescriptor clientDescriptor);

        void LoadCurrentPage();

        void LoadCurrentThemeManager();

        void LoadPage<TType>(TypeDescriptor pageDescriptor)
            where TType : IPage;

        void LoadSmartpart<TType>(int smartpartId, EventHandler<TypedObjectEventArgs<TType>> loadedHandler, params object[] constructorParameters)
            where TType : ISmartpart;

        void LoadSmartpart<TType>(TypeDescriptor smartpartDescriptor, EventHandler<TypedObjectEventArgs<TType>> loadedHandler, params object[] constructorParameters)
            where TType : ISmartpart;

        void LoadThemeManager<TType>(TypeDescriptor themeManagerDescriptor)
           where TType : IThemeManager;

        void LoadElement<TType>(TypeDescriptor elementDescriptor, EventHandler<TypedObjectEventArgs<TType>> loadedHandler, params object[] constructorParameters)
            where TType : UIElement;

    }

}